<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <div id="app">
        用户名：<input type="text" v-model="username"><br>
        密码：&nbsp;&nbsp;&nbsp;<input type="password" v-model="password"><br>
        <input type="button" value="提交" @click="submit">
    </div>

    <script src="../lib/Vue/vue.js"></script>
    <script src="../lib/jQuery/jquery.min.js"></script>
    <script>
        /*https://api.apiopen.top/developerLogin
        请求方式：    post
        参数：
        name：用户名
        passwd：密码
        admin  123456*/

        var vm = new Vue({
            el: '#app',
            data: {
                username: 'admin',
                password: '123456'
            },
            methods: {
                submit() {
                    $.ajax({
                        url: 'https://api.apiopen.top/developerLogin',
                        type: 'POST',
                        data: {
                            name: this.username,
                            passwd: this.password
                        },
                        success(res) {
                            console.log(res);
                            if (res.code == 200) {
                                window.open('http://www.baidu.com', '_blank')
                            }
                        }
                    })
                }
            }
        })
    </script>
</body>
</html>